package acwing;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;

public class ac3302 {
    static Stack<Character> op = new Stack<>();
    static Stack<Integer> num = new Stack<>();
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static Map<Character, Integer> pr = new HashMap<>();
    
    public static void main(String[] args) throws IOException {
        pr.put('+', 1);
        pr.put('-', 1);
        pr.put('*', 2);
        pr.put('/', 2);
        
        String str = in.readLine();
        for (int i = 0; i < str.length(); i ++ ) {
            char c = str.charAt(i);
            if (Character.isDigit(c)) {
                int x = 0, j = i;
                while(j < str.length() && Character.isDigit(str.charAt(j))){
                    x = x * 10 + str.charAt(j ++ ) - '0';
                }
                i = j - 1;
                num.push(x);
            }
            else if(c == '(') op.push(c);
            else if(c == ')') {
                while(op.peek() != '('){
                    eval();
                }
                op.pop();
            }
            else {
                while(!op.empty() && (op.peek() != '(') && (pr.get(op.peek()) >= pr.get(c))){
                    eval();
                }
                op.push(c);
            }
        }
        while (!op.empty()){
            eval();
        }
        System.out.println(num.peek());
        
    }
    
    public static void eval() {
        int b = num.pop();
        int a = num.pop();
        char c = op.pop();
        if(c == '+')
        {
            num.push(a + b);
        }
        else if(c == '-')
        {
            num.push(a - b);
        }
        else if(c == '*')
        {
            num.push(a * b);
        }
        else if (c=='/')
        {
            num.push(a / b);
        }
    }
}
